<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/admin/lib/html5shiv.js"></script>
<script type="text/javascript" src="/admin/lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui/css/H-ui.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/admin/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="/admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title></title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 检测业务 <span class="c-gray en">&gt;</span> 退样操作 
    <a class="btn btn-primary radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
	<table class="table table-border table-bordered table-hover table-bg table-responsive" id="datatable">
		<thead>
			{{-- <tr>
				<th scope="col" colspan="6">合同管理</th>
			</tr> --}}
			<tr class="text-c">
				<th>批次编号</th>
				<th>客户名称</th>
				<th>受理人</th>
				<th>受理时间</th>
				<th>批次状态</th>
				<th>样品总量</th>
				<th>操作</th>
			</tr>
        </thead>
        <tbody>
			@foreach ($data as $val)
				<tr class="text-c">
					<td>{{ $val->batchNum }}</td>
					<td>{{ $val->client_name }}</td>
					<td>{{ $val->creator }}</td>
					<td>{{ $val->created_at }}</td>
                    <td>
                        @if ($val->status==8)
                            <span class="badge badge-primary radius">审核中</span>
                        @elseif ($val->status==11)
                            <span class="badge badge-primary radius">待批准</span>
                        @elseif ($val->status==13)
                            <span class="badge badge-danger radius">批准驳回</span>
                        @elseif ($val->status==14)
                            <span class="badge badge-default radius">批准通过</span>
                        @elseif ($val->status==17)
                            <span class="badge badge-primary radius">待退样</span>
                        @else
                            <span class="badge badge-danger radius">未知</span>
                        @endif
                    </td>
					<td>{{ $val->sum_count }}</td>
                    <td>
						<a class="btn btn-primary radius size-MINI" href="javascript:;" onclick="send_back({{ $val->id }})">退样完成后 点我</a>
                    </td>
				</tr>
			@endforeach
			
		</tbody>
	</table>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="/admin/lib/layer/3.1.1/layer.js"></script>
<script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">

/* 跳转页面 */
function jump_page(url,id){
	location.href = url + '?id=' + id;
}

/*批准*/
function send_back(id){
    var index2;
	var str = '执行此操作前请确定样品已退回给客户，<br>确定要执行操作吗？';
	layer.confirm( str ,{title:'询问',icon:3},function(index){
		$.ajax({
			type: 'GET',
			url: '/{{config('constant.name_admin')}}/contract/sendBack' + '?id=' + id,
			// dataType: 'json',
			success: function(data){
                // console.log(data);
                if(data === '1'){
                    // table_reload(0);//0停留在当前页，1回到第一页
					window.location.reload();
                    layer.msg('操作成功!',{icon:1,time:2000});
                }else{
                    layer.msg('操作失败!',{icon:2,time:2000});
                }
			},
			error:function(data) {
                ajax_error(data);
            },
            beforeSend : function () { 
                //0.4透明度 白色遮罩
                index2 = layer.load(2,{ shade: [0.05,'#000'] }); 
            },
            complete : function () { 
                layer.close(index2); 
            },
		});		
	});
}
</script>
</body>
</html>